import * as API from '../utils/api'

export const LOAD_SITE_LIST = 'LOAD_SITE_LIST'
export const UPDATE_SITE_LIST = 'UPDATE_SITE_LIST'

export const loadSiteList = ({page = 1}) => dispatch => 
    ( 
        API.fetchSiteList({page})
        .then(json => dispatch(updateSiteList({...json})))
    )


export const updateSiteList = list => ({
    type: UPDATE_SITE_LIST,
    list
})